#ifndef FACEDETECTOR_H
#define FACEDETECTOR_H

#include <string>
#include <stack>
#include "ncnn/net.h"
#include <chrono>
#include <QImage>
#include "facestruct.h"
#include <opencv2/opencv.hpp>

using namespace std::chrono;

class FaceDetector
{

public:
    FaceDetector();

    void Init(const std::string &model_param, const std::string &model_bin);

    FaceDetector(const std::string &model_param, const std::string &model_bin);

    inline void Release();

    void nms(std::vector<Bbox> &input_boxes, float NMS_THRESH);

    void Detect(QImage& image, std::vector<Bbox>& boxes);
    void Detect2(cv::Mat image, std::vector<Bbox>& boxes);


    void create_anchor(std::vector<box> &anchor, int w, int h);

    inline void SetDefaultParams();

    static inline bool cmp(Bbox a, Bbox b);

    ~FaceDetector();

public:
    float _nms;
    float _threshold;
    float _mean_val[3];

    ncnn::Net *Net;
};
#endif // FACEDETECTOR_H
